package com.foreknow.hospital.service.impl;

import com.foreknow.hospital.dao.HospitalDao;
import com.foreknow.hospital.dao.SetmealDao;
import com.foreknow.hospital.dao.impl.HospitalDaoImpl;
import com.foreknow.hospital.dao.impl.SetmealDaoImpl3;
import com.foreknow.hospital.po.Hospital;
import com.foreknow.hospital.service.HospitalService;
import com.foreknow.hospital.util.DBUtil;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class HospitalServiceImpl implements HospitalService {

    @Override
    public List<Hospital> listHospital(Hospital hospital) {
        List<Hospital> hospitals = new ArrayList<Hospital>();
        HospitalDao hospitalDao = new HospitalDaoImpl();
        try {
            hospitals= hospitalDao.listHospital(hospital);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        return hospitals;
    }

    @Override
    public Hospital getHospitalById(Hospital hospital) {
     HospitalDao hospitalDao = new HospitalDaoImpl();
     //Hospital hospital1 = null;
        try {
            hospital= hospitalDao.getHospitalById(hospital);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        return hospital;
    }
}
